package com.cskaoyan.controller;

import com.cskaoyan.bean.*;
import com.cskaoyan.service.ConfigurationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("admin/config")
public class ConfigurationController {

    @Autowired
    ConfigurationService configurationService;

    @GetMapping("mall")
    public BaseRespVo mall(){
        Map map = configurationService.selectConfigurationMallList();

        return BaseRespVo.ok(map);
    }

    @PostMapping("mall")
    public BaseRespVo mall(@RequestBody MallDataBean mallDataBean){
        Integer integer = configurationService.updateConfigurationMallList(mallDataBean);
        return BaseRespVo.ok();
    }

    @GetMapping("express")
    public BaseRespVo express(){
        Map map = configurationService.selectExpressConfigurationList();
        return BaseRespVo.ok(map);
    }

    @PostMapping("express")
    public BaseRespVo express(@RequestBody ConfigExpressVO configExpressVO){
        Integer integer = configurationService.updateExpressConfigurationList(configExpressVO);
        return BaseRespVo.ok();
    }

    @GetMapping("order")
    public BaseRespVo order(){
        Map map = configurationService.selectOrderConfigurationList();
        return BaseRespVo.ok(map);
    }

    @PostMapping("order")
    public BaseRespVo order(@RequestBody ConfigOrderVO configOrderVO){
        Integer integer = configurationService.updateOrderConfigurationList(configOrderVO);
        return BaseRespVo.ok();
    }

    @GetMapping("wx")
    public BaseRespVo wx(){
        Map map = configurationService.selectWxConfigurationList();
        return BaseRespVo.ok(map);
    }

    @PostMapping("wx")
    public BaseRespVo wx(@RequestBody WxVO wxVO){
        Integer integer = configurationService.updateWxConfigurationList(wxVO);
        return BaseRespVo.ok();
    }




}
